<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableMessages extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up() {
		Schema::create('messages', function (Blueprint $table) {
			$table->increments('id');
			$table->integer('user_id')->comment('用户id')->index();
			$table->integer('reply_id')->default(-1)->comment('回复的用户id')->index();
			$table->string('content', 120)->comment('主体');
			$table->integer('favor')->default(0)->comment('被顶数量');
			$table->boolean('status')->default(true)->comment('状态');
			$table->timestamps();
			$table->softDeletes();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down() {
		Schema::dropIfExists('messages');
	}
}
